package net.chenlin.dp.modules.base.service.impl;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import net.chenlin.dp.modules.base.entity.SysPartEntity;
import net.chenlin.dp.modules.base.manager.SysPartManager;
import net.chenlin.dp.modules.base.service.SysPartService;

/**
 * 零件
 *
 * @author ZhouChenglin
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018年12月03日 下午9:49:25
 */
@Service("sysPartService")
public class SysPartServiceImpl implements SysPartService {

	@Autowired
	private SysPartManager sysPartManager;

	@Override
	public Page<SysPartEntity> listSysPart(Map<String, Object> params) {
		Query query = new Query(params);
		Page<SysPartEntity> page = new Page<>(query);
		sysPartManager.listSysPart(page, query);
		return page;
	}

	@Override
	public R saveSysPart(SysPartEntity role) {
		int count = sysPartManager.saveSysPart(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getSysPartById(Long id) {
		SysPartEntity sysPart = sysPartManager.getSysPartById(id);
		return CommonUtils.msg(sysPart);
	}

	@Override
	public R updateSysPart(SysPartEntity sysPart) {
		int count = sysPartManager.updateSysPart(sysPart);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = sysPartManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
